<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
</head>
<script th:src="@{/js/jquery-3.2.1.min.js}"></script>
<body>
    <div class="container">
        <form id="formdata" onsubmit="return false">
            <div class="form-group">
                <label for="booknum">图书编号</label>
                <input type="text" class="form-control" name="booknum" id="booknum">
            </div>
            <div class="form-group">
                <label for="bookname">图书名称</label>
                <input type="text" class="form-control" id="bookname" name="bookname" placeholder="书名">
            </div>
            <div class="form-group">
                <label for="username">借书人</label>
                <input type="text" class="form-control" id="username" name="username" placeholder="借书人">
            </div>
            <div class="form-group">
                <label for="useraccount">借书人账号</label>
                <input type="text" class="form-control" id="useraccount" name="useraccount" placeholder="借书人账号">
            </div>
            <div class="form-group">
                <label for="press">出版社</label>
                <input type="text" class="form-control" id="press" name="press" placeholder="出版社">
            </div>
            <!--<div class="form-group">-->
                <!--<label for="type">类型</label>-->
                <!--<select name="type" id="type">-->
                    <!--<option th:value="${type.id}" th:each="type : ${pTypes}" th:text="${type.name}"></option>-->
                <!--</select>-->
            <!--</div>-->
            <button id="sub" class="btn btn-default">借阅</button>
        </form>
    </div>
</body>
<script>
    $(function(){
        $("#sub").click(function(){
            $.ajax({
                url:"/borrow/insert",
                data:$("#formdata").serialize(),
                dataType:"json",
                type:"post",
                success:function(data){
                    if(data.code==200){
                        alert("借阅成功");
                    }
                }
            })
        })
    })
</script>
</html>